<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="show">
        <div>当前点击次数：{{message}}</div>
        <button id="add" v-on:click='add'>+</button>
        <!-- <button id="sub" v-on:click="sub">-</button> -->
        <button id="sub" @click="sub">-</button>
    </div>
    <script src="../vue.js"></script>
    <script>
        const vue = new Vue({
            el: '#show',
            data: {
                message: 0
            },
            methods: {
                add: function () {
                    console.log("add");
                    this.message++;
                },
                sub: function () {
                    console.log("sub");
                    this.message--;
                }
            }
        })
    </script>
    <div id="hello">{{message}}</div>
    <script src="../vue.js"></script>
    <script>
        const vue01 = new Vue({
            el: '#hello',
            data: {
                message: 'hello vuejs',
            }
        })
    </script>
</body>

</html>